/**
 * $Id$
 *
 * Unpublished Work Copyright 2013 Confirmit, Inc. All Rights Reserved.
 *
 * Last changed by $Author$
 * Last changed at $Date$
 */
package com.youtills.core.web;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * TODO
 *
 * @author Ravi Kumar Chiluveru (ravic)
 * @since 12.2, (5/19/13 10:47 AM)
 */
public class LayoutResponse<T extends ILayout> implements IResponse{
    private T layout;

    public LayoutResponse(T layout) {
        this.layout = layout;
    }

    public void processResponse(HttpServletRequest request, HttpServletResponse response, ServletContext context) throws IOException, ServletException {
        request.setAttribute("layout", layout);
        request.getRequestDispatcher(layout.getMainPage()).forward(request, response);
    }

}
